package me.frank.security.web;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import me.frank.security.entity.Test;
import me.frank.security.service.TestService;
import me.frank.security.support.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author Frank Wang
 * @Description:
 * @Date 2018/12/10 14:04
 */
@RestController
public class TestController {

    @Autowired
    private TestService testService;

    @PostMapping("/test")
    public Result saveTest(Test test){
        boolean save = testService.save(test);
        return Result.ok(save);
    }

    @GetMapping("/tests")
    public Result getAllTest(){
        List<Test> list = testService.list(new QueryWrapper<Test>());
        return Result.ok(list);
    }

}
